new Vue({
  el: "#app",
  data() {
    return {
      form: {
        SQLSerialNumber: "P_employee",
        PaginationNumber: 1, //页数
        RowAmount: 20, //每页数据条数
        Condition: "",
        ExtensionCondition: "",
      },
      formData: {},
      tableData: [], //表格数据
      total: 1,
      dialogForm: false,
      title: "",
      multipleSelection: [],
    };
  },
  mounted() {
    this.getList(this.form);
  },
  methods: {
    onSerach() {
      //查询方法
      console.log("搜搜");
    },
    addContract() {
      console.log("跳转");
    },
    getList(form) {
      // let a = $.cookie("enterprise");
      // console.log(a);
      let a = sessionStorage.getItem("Enterprise_Info_SerialNumber");
      console.log(a);
      //获取列表数据换页方法
      const that = this;
      let data = deepClone(form);
      data.Condition = window.btoa(
        unescape(encodeURIComponent($.cookie("enterprise")))
      );
      $.ajax({
        // headers: requestHeaders(),
        headers: {
          AccessToken: $.cookie("token"), //会将数据转换为query string
        },
        // url: `${BASE_URL2}/generalBusiness/generalPaginationQueryBySQLSerialNumber`,
        url: "https://service.kdddy.cn/donghui/generalBusiness/generalQueryByTableNameWithOriginal",
        type: "POST",
        data: {
          Data: "employee", //表名
          Condition:
            "Row_Status='0' And Enterprise_Info_SerialNumber ='" + a + "' ",
        },
        success: function (Result) {
          console.log(Result);

          that.tableData = Result;
          that.total = Result.TotalRows;
        },
        // complete: function (XMLHttpRequest) {
        // requestPretreatment(XMLHttpRequest);
        // },
        dataType: "json",
      });
    },
    Remove(row) {
      const that = this;
      this.$confirm("警告！此操作将删除该角色, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          row.Row_Status = "1";
          $.ajax({
            headers: requestHeaders(),
            url: `${BASE_URL2}/generalBusiness/generalSave`,
            type: "POST",
            data: {
              Data: JSON.stringify({
                Modify: { employee: [row] },
              }),
            },
            success: function (res) {
              if (res.Status === "success") {
                that.$message({
                  type: "success",
                  message: "删除成功!",
                });
                that.getList(that.form);
              } else {
                that.$message.error("删除失败，请稍后再试");
              }
            },
            complete: function (XMLHttpRequest) {
              that.loading = false;
              requestPretreatment(XMLHttpRequest);
            },
            dataType: "json",
          });
        })
        .catch(() => {});
    },
    addEnterprise() {
      window.location.href = "./Add.html";
    },
    editMember(Employee_SerialNumber) {
      sessionStorage.setItem("Employee_SerialNumber", Employee_SerialNumber);
      window.location.href =
        "./Edit.html?Employee_SerialNumber=" + Employee_SerialNumber;
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
  },
});
